Skip to content

Add support for 6 digits and keypad#48

Open
gdampf wants to merge 13 commits into
avishorp:masterfrom
gdampf:master
Open

Add support for 6 digits and keypad#48
gdampf wants to merge 13 commits into
avishorp:masterfrom
gdampf:master

Conversation

@gdampf

@gdampf gdampf commented Jan 21, 2019

Copy link
Copy Markdown

I optimized the timing for writing a command, so it is able to be followed by a read of keypad scan!

gdampf added 13 commits January 21, 2019 14:54
Extend to 6 digits and add keypad scan
Extend to 6 digits and add keypad scan
Add Keypad Scan
Extended to 6 digits and Keypad scan added
Minor change at stop sequence to avoid extra peak in DIO.
Adapt counter to around 1/100 sec per cycle
@JeremieForge

Copy link
Copy Markdown

Hello,
thanks for your optimization which allows me to display on a 6-digit display (the one from robotdyn).
However, the order of the digits is wrong. For example,
"123456" shows "321654"
"done__" shows "nod__e"

Do you know any workaround ?
thanks

@gdampf

gdampf commented Jun 25, 2019

Copy link
Copy Markdown
Author

Well, the library is writing the digits in a sequence. Your module seems to me ordering the digits in a special way. You may have three choices:
1st: solder the digits in the correct order (may be a bit heavy).
2nd: write a mapping routine, which reorders the digits in software that way, that digit 0 and 2, as well as digit 3 and 5 are switched.
3rd: Write the message, you want to display digit by digit with switched Position-Parameter - again 0 <-> 2, 3 <-> 5

Changing the TM1637Display.cpp to work with this messed pin wiring would mean, that we do not use the sequence writing any more. Which I would not place here. The failure is definitively at the hardware wiring.

BR
GUido

@JeremieForge

JeremieForge commented Jun 26, 2019

Copy link
Copy Markdown

Hey, ok I thougt so.
Unfortunately it's a pcb I can't solder another way.
I have to write a solution with my code and change the mapping of the digits yes. Problem is I'm going to have to display "000456" when wanting to display "456".
Thanks,
J.

@Wiles

Wiles commented Jan 28, 2020

Copy link
Copy Markdown

I was just about to do this. Glad I checked the open PRs first.

@hurbawoo

hurbawoo commented Dec 2, 2020

Copy link
Copy Markdown

I have the same robotdyn issue.
I just tried following modification.
It works, but its performance is poor due to the discontinuity of digits.

`void TM1637Display::setSegmentsOrg(const uint8_t segments[], uint8_t length, uint8_t pos)
{
// Write COMM1
start();
if (writeByte(TM1637_I2C_COMM1))
{
stop();
return;
}
stop();

// Write COMM2 + first digit address
start();
if (pos > 5) pos &= 0x03;
if (writeByte(TM1637_I2C_COMM2 + pos))
{
stop();
return;
}

// Write the data bytes
for (uint8_t k=length; k > 0; k--)
if(writeByte(segments[k-1]))
{
stop();
return;
}
stop();

// Write COMM3 + brightness
start();
if (writeByte(TM1637_I2C_COMM3 + (m_brightness & 0x0f)))
{
stop();
return;
}
stop();

// Write COMM4
start();
if (writeByte(TM1637_I2C_COMM4))
{
stop();
return;
}
m_KeyCode = readByte();
stop();
}

void TM1637Display::setSegments(const uint8_t segments[], uint8_t length, uint8_t pos)
{
// 0 1 2 3 4 5
// 2 1 0 5 4 3
uint8_t end, sep, head, tail;

if (length==0) length = m_noDigits;
end = pos + length - 1;
if (pos <= 2)
{
sep = (end < 2) ? end : 2;
head = sep - pos + 1;
setSegmentsOrg(segments, head, 2-sep);
}
if (end >= 3)
{
sep = (pos > 3) ? pos : 3;
tail = end - sep + 1;
setSegmentsOrg(&segments[head], tail, 8-end);
}
}
`

@hurbawoo

hurbawoo commented Dec 3, 2020

Copy link
Copy Markdown

I've modified the PCB, and it works well.
I need some quantity, so I have to order custom PCB.
RobotDyn

@luwiack

luwiack commented Jan 6, 2021

Copy link
Copy Markdown

3 years ago it was relased here:
https://github.com/TinyTronics/TM1637_6D

@wouterds

wouterds commented Mar 1, 2021

Copy link
Copy Markdown

I can confirm this actually works when downloading gdampf:master as ZIP & manually installing this!

@BleuLlama

Copy link
Copy Markdown

I just fixed this in my copy of the code. I changed the constructor of the class so that you can set the number of characters and a digit order remapping array. gonna get it checked in shortly.

@RileyStarlight

Copy link
Copy Markdown

I have a project with four displays, ten individual LEDs and ten pushbuttons, all controlled through a TM1637. This fork allows me to handle everything with great versatility. I thought I would have to create my own library and this has been a pleasant surprise.
Please consider to merge this fork!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants